package com.wisewin.pose.config.dto;

import com.wisewin.pose.util.env.Env;

public  class  ResultDTOBuilder {

    public ResultDTOBuilder() {}

    public static  ResultDTO success() {
        return new ResultDTO(true,"0000000" , Env.getProperty("0000000"),new Object());
    }

    public static  ResultDTO success(Object data) {
        return new ResultDTO(true,"0000000" ,Env.getProperty("0000000"),data);
    }

    public static  ResultDTO failure(String code) {
        return new ResultDTO(false,code ,Env.getProperty(code),new Object());
    }

    public static  ResultDTO failureMsg(String msg) {
        return new ResultDTO(false,"00003" ,msg,null);
    }

    public static  ResultDTO failure(String code,String msg) {
        return new ResultDTO(false,code ,msg,new Object());
    }

    public static  ResultDTO failure(String code,String msg,Object data) {
        return new ResultDTO(false,code ,msg,data);
    }

    public static  ResultDTO success(int row) {
        return row > 0?success():failure("00004");
    }

}